#  Ver 1.17
#  implement abstract gallery handler, hopefully can handle more galleries
#  implement thread pools, reduce the total number of threads, better for large gallery with number of images
from gallery_downloader import GD
import sys,socket

if __name__=="__main__":
  global thread_num
  assert sys.argv.__len__()==3,"two arguments required"
  socket.setdefaulttimeout(20)
  thread_num=10
  url=sys.argv[1]
  dir=sys.argv[2]
  import handlers
  handler = handlers.get_handler(url)
  gd = GD(handler,url,dir,thread_num=thread_num)
  gd.start_download()
